.TH std::expected::value_or 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::expected::value_or \- std::expected::value_or

.SH Synopsis
   template< class U >                               \fB(1)\fP (since C++23)
   constexpr T value_or( U&& default_value ) const&;
   template< class U >                               \fB(2)\fP (since C++23)
   constexpr T value_or( U&& default_value ) &&;

   Returns the contained value if *this contains an expected value, otherwise returns
   default_value.

   1) Returns bool(*this) ? **this : static_cast<T>(std::forward<U>(default_value))
   2) Returns bool(*this) ? std::move(**this) :
   static_cast<T>(std::forward<U>(default_value))

.SH Parameters

   default_value - the value to use in case *this does not contain an expected value
.SH Type requirements
   -
   T must meet the requirements of CopyConstructible in order to use overload \fB(1)\fP.
   -
   T must meet the requirements of MoveConstructible in order to use overload \fB(2)\fP.
   -
   U&& must be convertible to T

.SH Return value

   The currently contained value if *this contains an expected value, or default_value
   otherwise.

.SH Exceptions

   Any exception thrown by the selected constructor of the return value T.

.SH Notes

   If T is (possibly cv-qualified) void, this member is not declared.

.SH Example

    This section is incomplete
    Reason: no example

.SH See also

   value returns the expected value
         \fI(public member function)\fP

.SH Category:
     * Todo no example
